<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <title>Test Case for Issue #2122</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>

<h1>Issue #2122</h1>

<p>This test-case is intended for <a href="http://code.google.com/p/fbug/issues/detail?id=2122">Issue #2122</a>
- <span class="h3">Console stops auto-scrolling (again)</span>.
<br/>
<i>Jan Odvarko, odvarko@gmail.com</i>
</p>

<ol>
<li>Open the testcase, open Firebug, enable & select the Console panel.</li>
<li>Click the <span style="color:green">Execute Test</span> button.</li>
<li>Scroll to top.</li>
<li>Switch to the HTML panel.</li>
<li>Click the <span style="color:green">Execute Test</span> button and
wait till the button is enabled again.</li>
<li>Switch back to Console tab</li>
<li>The Console panel scroll position must be at the top.</li>
</ol>

<button id="testButton" onclick="executeTest()">Execute Test</button>

<script type="text/javascript">
function executeTest()
{
    var testButton = document.getElementById("testButton");
    testButton.disabled = true;

    onExecuteTest(40, function()
    {
        testButton.disabled = false;

        var event = document.createEvent("Events");
        event.initEvent("TestDone", true, false);
        testButton.dispatchEvent(event);
    });
}

function onExecuteTest(counter, callback)
{
    if (counter > 0)
    {
        setTimeout(function() {
            console.log("Just a test log: " + Math.random());
            onExecuteTest(--counter, callback);
        }, 100);
    }
    else
    {
        callback();
    }
}
</script>

</body>
</html>
